import { defineConfig } from 'vite'
import uni from '@dcloudio/vite-plugin-uni'
import AutoImport from 'unplugin-auto-import/vite'
import { UnifiedViteWeappTailwindcssPlugin as uvwt } from 'weapp-tailwindcss/vite'

export default defineConfig({
  plugins: [
    uni(),
    uvwt(),
    AutoImport({
      imports: ['vue', 'uni-app', 'pinia'],
      dts: './src/auto-imports.d.ts',
      eslintrc: {
        enabled: true
      }
    })
  ],
  resolve: {
    alias: {
      '@': '/src',
      '@/configs': '/src/configs',
      '@/utils': '/src/utils',
      '@/api': '/src/api',
      '@/store': '/src/store'
    }
  },
  css: {
    preprocessorOptions: {
      scss: {
        additionalData: '@import "@/styles/index.scss";',
        javascriptEnabled: true,
        silenceDeprecations: ['legacy-js-api']
      }
    },
    postcss: {
      plugins: require('./postcss.config').plugins
    }
  }
})
